package com.airlines.system.controller;

import com.airlines.system.domain.SysType;
import com.airlines.system.service.SysTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName TypeController
 * @Description 权限管理模块-系统类型控制器
 * @Author zhoujian
 * @Date 2018/9/18
 * @Version 1.0
 */
@Controller
@RequestMapping(value = "/api/system/type")
public class TypeController {

    @Autowired
    private SysTypeService sysTypeService;


    /**
     * 进入系统类型管理页面
     */
    @RequestMapping
    public String toPage() {
        return "system/accessManagement/sysManage";
    }

    /**查询所有的系统类型*/
    @RequestMapping(value = "list", method = RequestMethod.GET)
    @ResponseBody
    public List<SysType> findAllTypes() {
        return sysTypeService.findAll();
    }
 /*
    @ApiOperation("新增系统类型-点击保存按钮")
    @RequestMapping(value = "/addType", method = RequestMethod.POST)
    public ApiResponse<Boolean> addSysType(@RequestBody SysType sysType) {
        ApiResponse<Boolean> apiResponse = new ApiResponse<>();
        Boolean result = sysTypeService.addSysType(sysType);
        apiResponse.setData(result);
        return apiResponse;
    }

    @ApiOperation("修改系统类型-点击保存按钮")
    @RequestMapping(value = "/{id}/editType", method = RequestMethod.POST)
    public ApiResponse<Boolean> addSysType(@PathVariable String id, @RequestBody SysType sysType) {
        ApiResponse<Boolean> apiResponse = new ApiResponse<>();
        Boolean result = sysTypeService.editSysType(id, sysType);
        apiResponse.setData(result);
        return apiResponse;
    }*/
}
